import { IPSAppView } from '../../app/view/ipsapp-view';
import { IPSPickupView } from './ipspickup-view';
import { PSValueItemEditorImpl } from './psvalue-item-editor-impl';

export class PSPickupViewImpl extends PSValueItemEditorImpl implements IPSPickupView {
  get contextJOString(): string {
    return this.M.contextJOString;
  }

  get itemParamJO(): IModel {
    return this.M.itemParamJO;
  }

  get paramJOString(): string {
    return this.M.paramJOString;
  }

  protected pickuppsappview: IPSAppView | null = null;

  getPickupPSAppView(): IPSAppView | null {
    if (this.pickuppsappview != null) return this.pickuppsappview;
    const value = this.M.getPickupPSAppView;
    if (value == null) {
      return null;
    }
    this.pickuppsappview = this.getPSModel4('app.view.IPSAppView', value, 'getPickupPSAppView') as IPSAppView;
    return this.pickuppsappview;
  }

  get pickupPSAppView(): IPSAppView | null {
    return this.getPickupPSAppView();
  }

  getPickupPSAppViewMust(): IPSAppView {
    const value = this.getPickupPSAppView();
    if (value == null) {
      throw new Error('未指定选择视图');
    }
    return value;
  }

  get enablePickupView(): boolean {
    return this.M.enablePickupView;
  }

  get cls(): string {
    return 'PSPickupViewImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.IPSNavigateParamContainer' || cls == 'control.editor.IPSPickerEditor' || cls == 'control.editor.IPSPickupView') return true;
    return super.instanceof(cls);
  }
}
